//
//  OrderTableViewCell.m
//  JiongTu
//
//  Created by Dupengfei on 16/3/18.
//  Copyright © 2016年 YSKJ. All rights reserved.
//

#import "OrderTableViewCell.h"

#import "JTDriverTrip.h"
#import "JTUser.h"

#import "UIImageView+WebCache.h"

@interface OrderTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *headImage;

@property (weak, nonatomic) IBOutlet UILabel *driverName;
@property (weak, nonatomic) IBOutlet UILabel *carName;
@property (weak, nonatomic) IBOutlet UILabel *carPlate;
@property (weak, nonatomic) IBOutlet UILabel *isDriver;
@property (weak, nonatomic) IBOutlet UILabel *startlocation;
@property (weak, nonatomic) IBOutlet UILabel *endLocation;
@property (weak, nonatomic) IBOutlet UILabel *startTime;
@property (weak, nonatomic) IBOutlet UILabel *numberOfSeat;

@end

@implementation OrderTableViewCell

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.headImage.layer.cornerRadius = self.headImage.frame.size.width * 0.5;
    self.headImage.layer.masksToBounds = YES;
}

- (void)setOneDriverTrip:(JTDriverTrip *)oneDriverTrip {
    _oneDriverTrip = oneDriverTrip;
    self.startlocation.text = oneDriverTrip.start;
    self.endLocation.text = oneDriverTrip.end;
    self.isDriver.text =oneDriverTrip.identity;
    self.startTime.text = [NSString stringWithFormat:@"发车时间%@",oneDriverTrip.time];
    self.driverName.text = oneDriverTrip.driver.nickname;
    self.numberOfSeat.text =[NSString stringWithFormat:@"%d",[oneDriverTrip.seatCount intValue]-[oneDriverTrip.currentSeatCount intValue]];
    self.carName.text = oneDriverTrip.driver.carName;
    self.carPlate.text = oneDriverTrip.driver.carNumber;
    [self.headImage sd_setImageWithURL:oneDriverTrip.driver.iconPath placeholderImage:[UIImage imageNamed:@"头像占位"]];
}

@end
